The present invention relates to a method and apparatus for synthesising approximations to sine waves over a range of frequencies.
As shown in FIG. 6, an approximation to a sine wave 105 may be generated from a conveniently compact device by combining a number of pulse width modulated signals 102,103,104 generated by a microprocessor from its own clock signal 101. In order to produce a sine wave 105 having a different frequency, the frequency of the clock signal 101 is divided by a number such as 1,2,3,4 . . . etc. However, this produces discrete coarse steps in the resultant range of sine wave frequencies produced. For example if the clock signal in FIG. 6 has a frequency of 16 MHz, as may be used with a microprocessor, the highest sine wave frequency that can be synthesised in this example is 1 MHz, as sixteen clock cycles are needed to synthesise each sine wave cycle. The next highest sine wave frequency available is achieved by halving the clock frequency to 8 MHz producing a sine wave of 500 kHz. The next highest sine wave frequency is achieved by dividing the clock frequency by three to give a frequency of 5.3 MHz producing a resultant sine wave frequency of 330 kHz and so on.
As can be seen, large discrete steps or poor frequency resolution is produced in the resultant range of sine wave frequencies available.
According to a first aspect of the present invention an apparatus for synthesising an approximation to a sine wave comprises:
means for generating a number of pulse width modulated signals from a clock signal; and
means for combining the generated pulse width modulated signals to produce an approximation to a sine wave;
wherein the clock signal is provided by an oscillator arranged to produce clock signals over a continuous range of frequencies.
According to a further aspect of the present invention a method of synthesising an approximation to a sine wave comprises:
generating a number of pulse width modulated signals from a clock signal; and
combining the generated pulse width modulated signals to produce an approximation to a sine wave;
wherein the clock signal is provided by an oscillator arranged to produce clock signals over a continuous range of frequencies.
The use of the oscillator to produce clock signals over a continuous range of frequencies enables the production of resultant sine waves with a continuous range of frequencies rather than the discrete range discussed above.
The oscillator preferably produces a variation in its output clock signal frequency as a result of a variation in an input controlling electrical signal. The input controlling electrical signal that is varied is preferably a voltage making the oscillator a voltage controlled oscillator.
The output frequency of the oscillator and also of the approximation to a sine wave can thus be controlled by simply varying an input signal to the oscillator.
The approximation to a sine wave may be xe2x80x9csmoothedxe2x80x9d to remove at least some of the high frequency components by passing the signal through a low pass filter.
The sine wave produced may be used in a number of applications such as to match the frequency of the produced sine wave with the frequency of another detected signal or to provide stimulation which produces a particular effect at a particular unknown frequency which is then detected. In such applications it would be desirable to be able to determine the particular frequency which, in the above examples matches the detected frequency or produces the particular effect. The frequency need not necessarily be consistently related to the controlling input signal applied to the oscillator but may be variable due to, for example temperature changes.
To accurately determine a particular frequency of a synthesised approximation to a sine wave, the number of cycles of one of the pulse width modulated signals or the clock signal produced over a given period of time such as one second may be counted and/or the time taken to produce a fixed number of cycles may be measured and from this the frequency determined.
The means for generating pulse width modulated signals from a clock signal is preferably a processing means.